<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <style>
        #back {
            float: left;
            padding: 17px
        }

        #back img {
            width: 16px;
            height: 16px
        }

        nav {
            float: left;
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-orient: horizontal;
            -webkit-flex-flow: row;
            flex-flow: row;
            position: relative;
            width: 70%;
            margin-left: 4.5%;
            height: 50px;
        }

        nav .menu {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            flex: 1;
            width: 100%;
            height: 40px;
            line-height: 50px;
            font-size: 13px;
            color: #fff;
            text-align: center;
        }

        nav .menu.selected {
            font-size: 14px;
            color: #fff;
            font-weight: bolder;
        }

        #search {
            float: right;
            padding: 17px
        }

        #search img {
            width: 16px;
            height: 16px
        }

        #cont_list {
            height: 1148px;
            margin-top: 5px
        }

        #cont_list .title {
            font-size: 14px;
            height: 52px;
            border-bottom: 1px solid #F5F5F5;
            background: #FFF
        }

        #cont_list .title span {
            display: block;
            float: left;
            width: 3px;
            height: 12px;
            background: #666666;
            line-height: 52px;
            margin-left: 15px;
            margin-right: 12px;
            margin-top: 20px
        }

        #cont_list .title h3 {
            float: left;
            line-height: 52px;
            color: #333333;
        }

        #cont_list .title2 {
            font-size: 14px;
            height: 52px;
            border-bottom: 1px solid #F5F5F5;
            background: #FFF;
            margin-top: 20px;
            margin-bottom: -5px
        }

        #cont_list .title2 span {
            display: block;
            float: left;
            width: 3px;
            height: 12px;
            background: #666666;
            line-height: 52px;
            margin-left: 15px;
            margin-right: 12px;
            margin-top: 20px
        }

        #cont_list .title2 h3 {
            float: left;
            line-height: 52px;
            color: #333333;
        }

        #cont_list .cont_l {
            height: 80px;
            background: #FFF;
            margin-top: 5px;
            padding-left: 15px;
            border-bottom: 1px solid #F5F5F5
        }

        #cont_list .cont_l h2 {
            padding-top: 21px;
            margin-bottom: 14px;
            color: #333333;
            font-size: 13px;
            line-height: 2em
        }
    </style>
</head>

<body>


    <div id="cont_list">
        <div v-if="sj">
            <div class="cont_l" v-for="site in xmxq" @click="show_xmxq(site.uid,site.xid)">
                <h2>{{site.title}}</h2>
            </div>
        </div>

        <div v-else="sj">
            <div class="cont_l" v-for="site in xmxq" @click="show_xmxq(site.uid,site.xid)">
                <h2>{{site.title}}&nbsp;&nbsp;&nbsp;申请参加&nbsp;&nbsp;《{{site.name}}》&nbsp;&nbsp;项目</h2>
            </div>
        </div>

    </div>


</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
    apiready = function() {
        api.addEventListener({
            name: 'reload'
        }, function(ret, err) {
            api.showProgress({
                style: 'default',
                animationType: 'fade',
                title: '努力加载中...',
                text: '先喝杯茶...',
                modal: false
            });

            ajax()
        });
        api.showProgress({
            style: 'default',
            animationType: 'fade',
            title: '努力加载中...',
            text: '先喝杯茶...',
            modal: false
        });

        //
        api.setRefreshHeaderInfo({
            loadingImg: 'widget://image/refresh.png',
            bgColor: '#ccc',
            textColor: '#fff',
            textDown: '下拉刷新...',
            textUp: '松开刷新...'
        }, function(ret, err) {
            ajax();
        });
        //上拉更多
        api.addEventListener({
            name: 'scrolltobottom',
            extra: {
                threshold: 50 //设置距离底部多少距离时触发，默认值为0，数字类型
            }
        }, function(ret, err) {
            limt += 8;
            ajax();
            api.showProgress({
                style: 'default',
                animationType: 'fade',
                title: '努力加载中...',
                text: '先喝杯茶...',
                modal: false
            });
        });

        xmxqlist = new Vue({
            el: '#cont_list',
            data: {
                xmxq: [],
                sj: false
            }
        });

        if ($api.getStorage("shenfen") == 2) {
            xmxqlist.sj = true;
        } else {
            xmxqlist.sj = false;
        }
        ajax();
    };

    var xmxqlist;
    var limt = 8;



    function opsearch() {
        api.openWin({
            name: 'search',
            url: 'widget://html/search/search.html',
            slidBackEnabled: true,
            pageParam: {
                name: 'test'
            }
        });

    }




    function show_xmxq(uid, xid) {
        console.log(uid);
        console.log(xid);
        if ($api.getStorage("shenfen") == 2) {
            api.openWin({
                name: 'xmjj_show_win',
                url: 'widget://html/person/xmjj_show_win.html',
                pageParam: {
                    id: uid,
                    xid: xid
                }
            });
        } else if ($api.getStorage("shenfen") == 1) {
            api.openWin({
                name: 'jishou_show_win',
                url: 'widget://html/person/jishou_show_win.html',
                pageParam: {
                    id: uid,
                    xid: xid
                }
            });

        }


    }



    function ajax() {
        //  console.log(limt);
        api.ajax({
            url: $api.getStorage("backapi") + '/index.php?s=xiangmu&c=home&m=tongzhi',
            method: 'post',
            data: {
                values: {
                    uid: $api.getStorage("member"),
                    limt: limt,
                    sf: $api.getStorage("shenfen")
                }
            }
        }, function(ret, err) {
            if (ret) {
                xmxqlist.xmxq = ret.status;
            } else {
                console.log(JSON.stringify(err));
            }
            console.log(JSON.stringify(ret));
            api.refreshHeaderLoadDone()
            api.hideProgress();
        });

    }
</script>

</html>
